<%@page import="com.bill.common.system.dto.OrderDTO"%>
<%@page import="com.bill.common.system.service.IOrderService"%>
<%@page import="com.sinba.common.dto.PageDTO"%>
<%@page import="com.bill.common.system.dto.TransactionRecordDTO"%>
<%@page import="com.bill.common.system.service.ITransactionRecordService"%>
<%@page import="com.bill.common.user.dto.AccountDTO"%>
<%@page import="com.bill.common.user.service.IAccountService"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="../language.jsp" %>
<%
if(session.getAttribute("password2")==null){
	response.sendRedirect( "login2.jsp?pageUrl=user/orderMain.jsp");
	return;
}

ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
IOrderService orderService = (IOrderService)ac.getBean("orderService");
OrderDTO orderDTO = new OrderDTO();
orderDTO.setLoginName((String)session.getAttribute("loginName"));
int pages = 1;
String sidx = "id";
String sord="desc";
if(request.getParameter("pages")!=null && request.getParameter("_pages")!=""){
	pages = Integer.parseInt(request.getParameter("pages"));
}
int rows = 10;
int start = ( pages - 1 ) * rows;
orderDTO.setStart( start );
orderDTO.setLimit( rows );
PageDTO pageDTO = orderService.findOrderPager(orderDTO, sord, sidx);
if(pageDTO!=null){
	pageDTO.setPage( pages );
	pageDTO.setRows( rows );
}
request.setAttribute("pageDTO",pageDTO);

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<meta charset="UTF-8">
<title><fmt:message key="i18n.czManage"/>-<fmt:message key="i18n.title"/> </title>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1" />

<!-- Bootstrap framework -->
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" />
    <link rel="stylesheet" href="bootstrap/css/bootstrap-responsive.min.css" />
<!-- breadcrumbs-->
	<link rel="stylesheet" href="lib/jBreadcrumbs/css/BreadCrumb.css" />
<!-- main styles -->
    <link rel="stylesheet" href="css/sub_page_main_style.css" />

<!--[if lte IE 8]>
    <link rel="stylesheet" href="css/ie.css" />
    <script src="js/ie/html5.js"></script>
    <script src="js/ie/respond.min.js"></script>
<![endif]-->

</head>
<body style="height:800px">

<div id="contentwrapper">
	<div class="main_content">
		 <nav>
            <div id="jCrumbs" class="breadCrumb module">
                <ul>
                    <li>
                        <a href="main.jsp"><i class="icon-home"></i></a>
                    </li>
                    <li>
                        <a href="#"><fmt:message key="i18n.moneyManage"/></a>
                    </li>
                    <li>
                        <a href="#"><fmt:message key="i18n.onlinePayData"/></a>
                    </li>
                </ul>
            </div>
         </nav>
         
<form id="bonusSeachForm" action="orderMain.jsp" method="post">
<input name="sidx" value="id" type="hidden" >
<input name="sord" value="desc" type="hidden" >
<input name="orderDTO.loginName" value="${session.loginName }" type="hidden" >
</form>

<table class="table table-bordered table-striped" id="smpl_tbl"> 
		        		<thead>
		        			
		        			<tr class="color1">
		        				<th><fmt:message key="i18n.orderId"/></th>
		        				<th><fmt:message key="i18n.czMoney"/></th>
		        				<th><fmt:message key="i18n.status"/></th>
		        				<th><fmt:message key="i18n.time"/></th>
		        				<th><fmt:message key="i18n.operation"/></th>
		        			</tr>
		        			
		        		</thead>
		        		<tbody>
		        			<c:forEach items="${pageDTO.data}" var="data">
		        				<tr>
		        					<td>${data.orderNo}</td>
		        					<td><fmt:formatNumber value="${data.payMoeny}" pattern="#0.0000"/></td>
		        					<td>${data.orderStatus}</td>
		        					<td><fmt:formatDate value="${data.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
		        					<td><c:if test="${data.orderStatus eq '待支付'}"><a style="color: red;" href="orderPage.jsp?orderId=${data.id}">[<fmt:message key="i18n.onlinePay"/>]</a></c:if></td>
		        				</tr>
		        			</c:forEach>
		        			<c:if test="${empty pageDTO.data}">
		        				<tr>
		        					<td colspan="5" align="center"><fmt:message key="i18n.noData"/>!</td>
		        				</tr>
		        			</c:if>
		        		</tbody>		        		
		        	</table>
		        	<div class="page">
		        		<div id="tr_orderGrid_pager" class="page_r">
		        		<ul>
			        		<li><a href="orderMain.jsp?pages=1"><fmt:message key="i18n.firstPage"/></a></li>
			        		<c:if test="${pageDTO.page!=1}">
			        			<li><a href="orderMain.jsp?pages=${pageDTO.page-1}"><fmt:message key="i18n.upPage"/>-</a></li>
			        		</c:if>
			        		<li><a><fmt:message key="i18n.nowPage"/>:${pageDTO.page}/${pageDTO.total}</a></li>
			        		<c:if test="${pageDTO.page+1<=pageDTO.total}">
			        			<li><a href="orderMain.jsp?pages=${pageDTO.page+1}">-<fmt:message key="i18n.nextPage"/></a></li>
			        		</c:if>
			        		<li><a href="orderMain.jsp?pages=${pageDTO.total}"><fmt:message key="i18n.endPage"/></a></li>
			        		<li><a>&nbsp;&nbsp;<fmt:message key="i18n.total"/>${pageDTO.totalSize}<fmt:message key="i18n.tiao"/></a></li>
		        		</ul>
		        	</div>
		        	</div>
		        	
		        	</div></div>
		        	
		  <script type="text/javascript" src="../scripts/jquery/jquery-1.4.2.min.js"></script>      	
		        	
</body>
</html>